package cn.iocoder.yudao.module.ad.dal.mysql.account;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ad.dal.dataobject.account.AdAccountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ad.controller.admin.account.vo.*;

/**
 * 广告账号 Mapper
 *
 * @author 数创万维
 */
@Mapper
public interface AdAccountMapper extends BaseMapperX<AdAccountDO> {

    default PageResult<AdAccountDO> selectPage(AdAccountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AdAccountDO>()
                .eqIfPresent(AdAccountDO::getChannelId, reqVO.getChannelId())
                .likeIfPresent(AdAccountDO::getName, reqVO.getName())
                .eqIfPresent(AdAccountDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(AdAccountDO::getApiKey, reqVO.getApiKey())
                .eqIfPresent(AdAccountDO::getApiSecret, reqVO.getApiSecret())
                .betweenIfPresent(AdAccountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AdAccountDO::getId));
    }

}